home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / casterli.arc / STACK.4TH < prev   
Encoding:
Text File  |  1986-04-26  |  3.1 KB  |  1 lines

  1. ( Stack Words - Screen 1 )                                                                                                                                                                                                                                                                                                                                                                      : ITEMADDR ( ITEM --- ADDRESS ) DUP DEPTH 2 - <= IF 2 *           SP@ + ELSE DROP ." ITEMADDR: Item deeper than stack! "          CR ." OK " CR SP! QUIT THEN ;                                   ( Get address of stack item ITEM )                                                                                                                                                                                                                                                                                                                                                                                                                         -->( Stack Words - Screen 2 )                                                                                                      : .P CR DEPTH 0= IF ." .P: Stack Empty.  " CR QUIT THEN           ." (Top) " DEPTH 1+ 1 DO I PICK . LOOP ." (Bottom) " CR SP!     ." The stack has been emptied. " CR ;                           ( Does a [signed] stack print, then clears stack )                                                                                                                                            : S. CR DEPTH 0= IF ." S.: Stack Empty. " CR QUIT THEN            ." (Top) " DEPTH 1+ 1 DO I PICK . LOOP ." (Bottom) " CR ;       ( Does a [signed] stack print without clearing stack )                                                                                                                                                                                                                                                                                                                                     -->( Stack Words - Screen 3 )                                                                                                      ( : USPLIT DUP DUP 0 256 U/ SWAP DROP 256 U* DROP -   )         ( SWAP 0 256 U/ SWAP DROP SWAP ;                      )           ( U --- MSB LSB ) ( Unsigned number replaced by MSB & LSB )     ( NEED A U/ DEF TO MAKE THIS WORK WITH MVPFORTH! )                                                                            : UJOIN SWAP 256 * + ;                                            ( MSB LSB --- U ) ( MSB & LSB replaced by unsigned number )